#include <stdio.h>
#include <time.h>
#include <math.h>

#define MAXN 10
#define MAXK 1e6
double f1 (double x) {
    double p = 1;
    for (int i = 1; i < 101; ++i) {
        p += pow(x, i) / i;
    }
    return p;
}

double f2 (double x) {
    double p = 1/100;
    for (int i = 100; i > 1; --i) {
        p = 1/(i-1) + x * p;
    }
    return p*x + 1;
}

int main(int argc, char *argv[]) {
    double start, end;
    double a[MAXN];
    for (int i = 0; i < MAXN; ++i) {
        a[i] = i;
    }

    start = clock();
    for (int i = 0; i < MAXK; ++i) {
        f1(1.1);
    }
    end = clock();
    printf("tick1 = %.6f\n", (double)(end - start));
    printf("f1: %.6f\n", (double)((end - start) / CLOCKS_PER_SEC));

    start = clock();
    for (int i = 0; i < MAXK; ++i) {
        f2(1.1);
    }
    end = clock();
    printf("tick2 = %.6f\n", (double)(end - start));
    printf("f1: %.6f\n", (double)((end - start) / CLOCKS_PER_SEC));
    return 0;
}